package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingPlan;
import com.zzyl.entity.NursingProjectPlan;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectPlanVo;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface NursingPlanMapper {
    List<NursingPlanVo> selectAll();

    Page<NursingPlanVo> selectPageByNameAndStatus(String name, Integer status);

    int countByPlanName(String planName);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into nursing_plan(plan_name,status,sort_no,create_by,update_by,remark,create_time,update_time)" +
            "values(#{planName},#{status},#{sortNo},#{createBy},#{updateBy},#{remark},#{createTime},#{updateTime})")
    int insert(NursingPlan nursingPlan);

    void insertProjectPlan(List<NursingProjectPlan> nursingProjectPlans);

    NursingPlanVo selectById(Long id);

    List<NursingProjectPlanVo> selectProjectPlanById(Long id);

    int updateNursingPlan(NursingPlan nursingPlan);

    void deleteProjectPlan(Long id);

    int deleteById(Long id);

    int updateNursingPlanStatus(Long id, Integer status);

    Integer countPlanId(Long id);
}
